package com.flycat.common.util;

import com.flycat.common.enumeration.SysRoleEnum;

import java.util.Objects;

/**
 * @Author yalei.chen
 * @Date 2017/10/21
 * @Since JDK 1.8
 */
public class RoleUtils {

    /**
     * 商户账号类型转换为用户角色
     * @param type
     * @return
     */
    public static SysRoleEnum merchantType2Role(Byte type) {

        if(Objects.isNull(type)){
            return null;
        }

        switch (type){
            case 1:
                return SysRoleEnum.ADMIN;
            case 2:
                return SysRoleEnum.SUPPLIER;
            case 3:
                return SysRoleEnum.DISTRIBUTOR;
            default:
                return null;
        }

    }
}
